﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LIB
{
    public class ComFunction
    {
       
    }
    public class unixTimestamp   
    {   
        protected static readonly DateTime unixTPStart =   
            TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));   
        public static long toUTP(DateTime dt)   
        {   
            TimeSpan toNow = dt.Subtract(unixTPStart);   
            return (long)Math.Round(toNow.TotalSeconds);   
        }   
        public static DateTime fromUTP(long tp)   
        {   
            return unixTPStart.Add(new TimeSpan(tp * 10000000));   
        }   
    }   
}
